package control;

import com.mysql.jdbc.MySQLConnection;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import java.sql.Connection;
import java.sql.SQLException;
import oracle.jdbc.pool.OracleDataSource;

public class OraConnection {

    public static Connection open(String url, String userId, String password) {
        Connection conn = null;
        try {
            MysqlDataSource ds;
            ds = new MysqlDataSource();
            ds.setURL(url);
            conn = ds.getConnection(userId, password);
            System.out.println("Koneksi is OK");
        } catch (SQLException e) {
// perform error handling here
            System.out.println("error :" + e.getMessage());
        }
        return conn;
    }

    public static Connection getKoneksi() {
        String jdbcUrl = "jdbc:mysql://localhost:3306/pti";
        String userid = "root"; // gantikan dengan username anda
        String password = ""; // gantikan dengan password anda
        return open(jdbcUrl, userid, password);
    }
}